package com.bana.fvs.app.main.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.bana.fvs.R;
import com.bana.fvs.app.base.PageBaseParams;
import com.bana.fvs.app.module.tab2.Tab2CommonFragment;
import com.bana.fvs.app.module.tab2.VisibilityFragment;

/**
 * Author : yanftch
 * Date : 2018/2/26
 * Time : 17:16
 * Desc : tab2里边，外层3个Fragment 的适配器
 */

public class Tab2CommonAdapter extends FragmentPagerAdapter {

    public class Params extends PageBaseParams {
        public static final int params_type0 = 0;
        public static final int params_type1 = 1;
        public static final int params_type2 = 2;
    }

    private Context mContext;

    public Tab2CommonAdapter(Context context, FragmentManager fm) {
        super(fm);
        this.mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 1) {
            return VisibilityFragment.newInstance(position);
        }
        return Tab2CommonFragment.newInstance(position);

    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return mContext.getString(R.string.tab_title_main2);
//            case 1:
//                return mContext.getString(R.string.weather_instrument);
            case 1:
                return mContext.getString(R.string.tab_title_main1);
//                return mContext.getString(R.string.tab_title_main3);
        }
        return "";
    }
}
